package com.ldzy.webase.service.impl;

import com.ldzy.webase.dao.ConsultMapper;
import com.ldzy.webase.entity.Consult;
import com.ldzy.webase.exception.ExceptionResponse;
import com.ldzy.webase.exception.ExceptionResponseCode;
import com.ldzy.webase.service.ConsultService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ：Lq
 * @version ：1.0
 * @date ：2022/10/26 13:48
 * @description ：t_consult-咨询分类表-业务层
 */
@Service
public class ConsultServiceImpl implements ConsultService {
    @Autowired
    ConsultMapper consultMapper;

    /**
     * @author ：Lq
     * @date ：2022/10/26 13:53
     * @description ：获取全部咨询分类
     */
    @Override
    public List<Consult> getConsultAll() {
        List<Consult> consultAllByMore = consultMapper.getConsultAll();

        if(consultAllByMore.size() == 0){
            throw ExceptionResponse.build(ExceptionResponseCode.ERROR_NOT_TOKEN); // (401, "服务器开小差了")
        }

        return consultAllByMore;
    }
}
